define(["jquery","template",
	"scprit/nutrition/app/nutritionApplication/nutritionApplicationList.servers.js",
	"scprit/nutrition/template/nutritionApplication/nutritionApplicationList.tpl.js"], 
    function($,template,$servers,tpl){
    var ui = {};

    var drawList = function(data){
    	return template("nutrition_applicationList",data);
    }
    var drawTopStatistics = function(data){
        return template("nutrition_application_topStatistics",data);
    }
    var drawBottomStatistics = function(data){
        return template("nutrition_application_bottomStatistics",data);
    }

    ui.listInit = function(options){
        $("#" + options.id).html(tpl.init());
        var html = drawList($servers.handleList(options.list,options.rows));
        $("#" + options.id).html(html);
    };
    ui.topStatisticsInit = function(options){
        $("#" + options.id).html(tpl.topStatistics());
        var html = drawTopStatistics(options.data);
        $("#" + options.id).html(html);
    };
    ui.bottomStatisticsInit = function(options){
        $("#" + options.id).html(tpl.bottomStatistics());
        var html = drawBottomStatistics(options.data);
        $("#" + options.id).html(html);
    };

    return ui;
});